// 추천인 관련 타입 정의

export interface ReferredUser {
  id: number;
  name: string;
  idNumber: string;
  createdAt: string;
  status: string;
  balance?: {
    total: number;
  };
}

export interface Referrer {
  id: number;
  referralCode: string | null;
  name: string;
  idNumber: string;
  createdAt: string;
  _count: {
    referredUsers: number;
  };
  referredUsers: ReferredUser[];
}

export interface ReferrerListResponse {
  referrers: Referrer[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    totalPages: number;
  };
}

export interface ReferrerDetailResponse {
  referrer: {
    id: number;
    referralCode: string | null;
    name: string;
    idNumber: string;
    createdAt: string;
    _count: {
      referredUsers: number;
    };
  };
  referredUsers: ReferredUser[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    totalPages: number;
  };
}

export interface ReferralSettings {
  id: number;
  userId: number | null;
  depositRate: number;
  stakingRate: number;
  isActive: boolean;
  createdAt: string;
  updatedAt: string;
  user?: {
    id: number;
    name: string;
    referralCode: string | null;
  };
}

export interface ReferralSettingsResponse {
  global: ReferralSettings;
  users: ReferralSettings[];
}

export interface ReferralStats {
  totalReferrers: number;
  totalReferred: number;
  todayReferred: number;
  totalRewards: number;
  totalStakingRewards: number;
}

export interface ReferralSearchParams {
  page?: number;
  limit?: number;
  search?: string;
}

export interface ReferralSettingsUpdateData {
  depositRate?: number;
  stakingRate?: number;
  isActive?: boolean;
}

export interface UserReferralSettingsData extends ReferralSettingsUpdateData {
  userId: number;
}

export interface RemoveReferralRequest {
  userId: number;
  reason?: string;
}

export interface RemoveReferralResponse {
  userId: number;
  userName: string;
  originalReferrer: {
    id: number;
    name: string;
    referralCode: string | null;
  } | null;
}